﻿#region Header

/*
Behavioral Rating of Dancing Human Crowds based on Motion Patterns
By

Pascal Hauser 
Dipl. Ing. in Informatik, Hochschule für Technik Rapperswil, 2006
Master Thesis, Hochschule für Technik Rapperswil, 2008-2010

and

Raphael Gfeller
Dipl. Ing. in Informatik, Hochschule für Technik Rapperswil, 2006
Master Thesis, Hochschule für Technik Rapperswil, 2008-2010

*/

#endregion

#region Usings

using System;
using Emgu.CV;
using Emgu.CV.Structure;
using paravili.Services;
using Sebarf.Services.Interfaces;

#endregion

namespace paravili.Steps {
	/// <summary>
	/// Converts a Image<Bgr, Byte> to a Image<Lab, Byte> image
	/// </summary>
	public class ImageCopy : ProcessStepConverterWithMeasurement<Image<Lab, Byte>, Image<Lab, Byte>> {
		#region Public Properties

		[ServiceRequest(IsOptional = true)]
		public IImageProviderService ImageProviderService { get; set; }

		[ConfigurabelStringValue(Name = "ImageProviderId")]
		public String ImageProviderId { get; set; }

		[ConfigurabelBooleanValue(Name = "ForwardImageToImageProvider")]
		public bool ForwardImageToImageProvider { get; set; }

		#endregion

		#region Public Methods

		public ImageCopy() {
			ImageProviderId = "ImageCopy.ImageData";
			ForwardImageToImageProvider = true;
		}

		protected override Image<Lab, byte> Convert(Image<Lab, byte> toProcess) {
			if (toProcess == null) {
				return null;
			}

			ImageProviderService.SetImage(ImageProviderId, toProcess.Copy());

			return toProcess;
		}

		#endregion
	}
}